package com.itheima.spring.cyclicDependency.test;

import com.itheima.spring.cyclicDependency.bean.UserA;
import com.itheima.spring.cyclicDependency.bean.UserB;
import com.itheima.spring.cyclicDependency.config.MyConfig;
import com.itheima.spring.cyclicDependency.core.AnnotationConfigApplicationContext4;

public class MainStart {

    public static void main(String[] args) {

        AnnotationConfigApplicationContext4 applicationContext = new AnnotationConfigApplicationContext4(MyConfig.class);

        UserA userA = applicationContext.getBean("userA", UserA.class);
        UserB userB1 = userA.getUserB();
        userB1.run();

        UserB userB = applicationContext.getBean("userB", UserB.class);
        UserA userA1 = userB.getUserA();
        userA1.run();
    }
}
